home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 January / enter-2004-01.iso / files / maxima-5.9.0.exe / {app} / info / maxima.info-7 < prev    next >
Encoding:
GNU Info File  |  2003-02-09  |  44.6 KB  |  965 lines

  1. This is maxima.info, produced by makeinfo version 4.1 from maxima.texi.
  2.  
  3.    This is a Texinfo Maxima Manual
  4.  
  5.    Copyright 1994,2001 William F. Schelter
  6.  
  7. START-INFO-DIR-ENTRY
  8. * Maxima: (maxima).     A computer algebra system.
  9. END-INFO-DIR-ENTRY
  10.  
  11. 
  12. File: maxima.info,  Node: Definitions for Integration,  Prev: Introduction to Integration,  Up: Integration
  13.  
  14. Definitions for Integration
  15. ===========================
  16.  
  17.  - Function: CHANGEVAR (exp,f(x,y),y,x)
  18.      makes the change of variable given by f(x,y) = 0 in all integrals
  19.      occurring in exp with integration with respect to x; y is the new
  20.      variable.
  21.               (C1) 'INTEGRATE(%E**SQRT(A*Y),Y,0,4);
  22.                                   4
  23.                                  /
  24.                                  [    SQRT(A) SQRT(Y)
  25.               (D1)               I (%E               ) dY
  26.                                  ]
  27.                                  /
  28.                                   0
  29.               (C2) CHANGEVAR(D1,Y-Z^2/A,Z,Y);
  30.                                              2 SQRT(A)
  31.                                             /
  32.                                             [              Z
  33.                                           2 I          Z %E  dZ
  34.                                             ]
  35.                                             /
  36.                                              0
  37.               (D4)                        ---------------------
  38.                                                     A
  39.      CHANGEVAR may also be used to changes in the indices of a sum or
  40.      product.  However, it must be realized that when a change is made
  41.      in a sum or product, this change must be a shift, i.e. I=J+ ...,
  42.      not a higher degree function.  E.g.
  43.           (C3) SUM(A[I]*X^(I-2),I,0,INF);
  44.                                          INF
  45.                                          ====
  46.                                          \         I - 2
  47.           (D3)                            >    A  X
  48.                                          /      I
  49.                                          ====
  50.                                          I = 0
  51.           (C4) CHANGEVAR(%,I-2-N,N,I);
  52.                                         INF
  53.                                         ====
  54.                                         \               N
  55.           (D4)                           >      A      X
  56.                                         /        N + 2
  57.                                         ====
  58.                                         N = - 2
  59.  
  60.  - Function: DBLINT ('F,'R,'S,a,b)
  61.      a double-integral routine which was written in top-level macsyma
  62.      and then translated and compiled to machine code.  Use
  63.      LOAD(DBLINT); to access this package.  It uses the Simpson's Rule
  64.      method in both the x and y directions to calculate /B /S(X) |  | |
  65.      |    F(X,Y) DY DX .  |  | /A /R(X) The function F(X,Y) must be a
  66.      translated or compiled function of two variables, and R(X) and
  67.      S(X) must each be a translated or compiled function of one
  68.      variable, while a and b must be floating point numbers. The
  69.      routine has two global variables which determine the number of
  70.      divisions of the x and y intervals: DBLINT_X and DBLINT_Y, both of
  71.      which are initially 10, and can be changed independently to other
  72.      integer values (there are 2*DBLINT_X+1 points computed in the x
  73.      direction, and 2*DBLINT_Y+1 in the y direction).  The routine
  74.      subdivides the X axis and then for each value of X it first
  75.      computes R(X) and S(X); then the Y axis between R(X) and S(X) is
  76.      subdivided and the integral along the Y axis is performed using
  77.      Simpson's Rule; then the integral along the X axis is done using
  78.      Simpson's Rule with the function values being the Y-integrals. This
  79.      procedure may be numerically unstable for a great variety of
  80.      reasons, but is reasonably fast: avoid using it on highly
  81.      oscillatory functions and functions with singularities (poles or
  82.      branch points in the region).  The Y integrals depend on how far
  83.      apart R(X) and S(X) are, so if the distance S(X)-R(X) varies
  84.      rapidly with X, there may be substantial errors arising from
  85.      truncation with different step-sizes in the various Y integrals.
  86.      One can increase DBLINT_X and DBLINT_Y in an effort to improve the
  87.      coverage of the region, at the expense of computation time. The
  88.      function values are not saved, so if the function is very
  89.      time-consuming, you will have to wait for re-computation if you
  90.      change anything (sorry).  It is required that the functions F, R,
  91.      and S be either translated or compiled prior to calling DBLINT.
  92.      This will result in orders of magnitude speed improvement over
  93.      interpreted code in many cases!  The file SHARE1;DBLINT DEMO can
  94.      be run in batch or demo mode to illustrate the usage on a sample
  95.      problem; the file SHARE1;DBLNT DEMO1 is an extension of the DEMO
  96.      which also makes use of other numerical aids, FLOATDEFUNK and
  97.      QUANC8.  Please send all bug notes and questions to LPH
  98.  
  99.  
  100.  - Function: DEFINT (exp, var, low, high)
  101.      DEFinite INTegration, the same as INTEGRATE(exp,var,low,high).
  102.      This uses symbolic methods, if you wish to use a numerical method
  103.      try ROMBERG(exp,var,low,high).
  104.  
  105.  
  106.  - Function: ERF (X)
  107.      the error function, whose derivative is: 2*EXP(-X^2)/SQRT(%PI).
  108.  
  109.  
  110.  - Variable: ERFFLAG
  111.      default: [TRUE] if FALSE prevents RISCH from introducing the ERF
  112.      function in the answer if there were none in the integrand to
  113.      begin with.
  114.  
  115.  
  116.  - Variable: ERRINTSCE
  117.      default: [TRUE] - If a call to the INTSCE routine is not of the
  118.      form
  119.  
  120.           EXP(A*X+B)*COS(C*X)^N*SIN(C*X)
  121.  
  122.      then the regular integration program will be invoked if the switch
  123.      ERRINTSCE[TRUE] is TRUE.  If it is FALSE then INTSCE will err out.
  124.  
  125.  
  126.  - Function: ILT (exp, lvar, ovar)
  127.      takes the inverse Laplace transform of exp with respect to lvar
  128.      and parameter ovar.  exp must be a ratio of polynomials whose
  129.      denominator has only linear and quadratic factors.  By using the
  130.      functions LAPLACE and ILT together with the SOLVE or LINSOLVE
  131.      functions the user can solve a single differential or convolution
  132.      integral equation or a set of them.
  133.           (C1) 'INTEGRATE(SINH(A*X)*F(T-X),X,0,T)+B*F(T)=T**2;
  134.                         T
  135.                        /
  136.                        [                                     2
  137.           (D1)         I (SINH(A X) F(T - X)) dX + B F(T) = T
  138.                        ]
  139.                        /
  140.                        0
  141.           (C2) LAPLACE(%,T,S);
  142.                       A LAPLACE(F(T), T, S)
  143.           (D2)        ---------------------
  144.                               2    2
  145.                              S  - A
  146.                                                     2
  147.                           + B LAPLACE(F(T), T, S) = --
  148.                                                      3
  149.                                                     S
  150.           (C3) LINSOLVE([%],['LAPLACE(F(T),T,S)]);
  151.           SOLUTION
  152.                                                   2      2
  153.                                                2 S  - 2 A
  154.           (E3)       LAPLACE(F(T), T, S) = --------------------
  155.                                               5         2     3
  156.                                            B S  + (A - A  B) S
  157.           (D3)                         [E3]
  158.           (C4) ILT(E3,S,T);
  159.           IS  A B (A B - 1)  POSITIVE, NEGATIVE, OR ZERO?
  160.           POS;
  161.                                                  2
  162.                                  SQRT(A) SQRT(A B  - B) T
  163.                           2 COSH(------------------------)
  164.                                             B
  165.           (D4)  F(T) =  - --------------------------------
  166.                                          A
  167.                         2
  168.                      A T             2
  169.                   + ------- + ------------------
  170.                     A B - 1    3  2      2
  171.                               A  B  - 2 A  B + A
  172.  
  173.  - Function: INTEGRATE (exp, var)
  174.      integrates exp with respect to var or returns an integral
  175.      expression (the noun form) if it cannot perform the integration
  176.      (see note 1 below).  Roughly speaking three stages are used:
  177.         *     (1) INTEGRATE sees if the integrand is of the form
  178.           F(G(X))*DIFF(G(X),X) by testing whether the derivative of some
  179.           subexpression (i.e. G(X) in the above case) divides the
  180.           integrand.  If so it looks up F in a table of integrals and
  181.           substitutes G(X) for X in the integral of F.  This may make
  182.           use of gradients in taking the derivative.  (If an unknown
  183.           function appears in the integrand it must be eliminated in
  184.           this stage or else INTEGRATE will return the noun form of the
  185.           integrand.)
  186.  
  187.         *     (2) INTEGRATE tries to match the integrand to a form for
  188.           which a specific method can be used, e.g.  trigonometric
  189.           substitutions.
  190.  
  191.         *     (3) If the first two stages fail it uses the Risch
  192.           algorithm.      Functional relationships must be explicitly
  193.           represented in order for INTEGRATE to work properly.
  194.           INTEGRATE is not affected by DEPENDENCIES set up with the
  195.           DEPENDS command.  INTEGRATE(exp, var, low, high) finds the
  196.           definite integral of exp with respect to var from low to high
  197.           or returns the noun form if it cannot perform the
  198.           integration.  The limits should not contain var.  Several
  199.           methods are used, including direct substitution in the
  200.           indefinite integral and contour integration.  Improper
  201.           integrals may use the names INF for positive infinity and
  202.           MINF for negative infinity.  If an integral "form" is desired
  203.           for manipulation (for example, an integral which cannot be
  204.           computed until some numbers are substituted for some
  205.           parameters), the noun form 'INTEGRATE may be used and this
  206.           will display with an integral sign.  (See Note 1 below.)
  207.           The function LDEFINT uses LIMIT to evaluate the integral at
  208.           the lower and upper limits.      Sometimes during integration
  209.           the user may be asked what the sign of an expression is.
  210.           Suitable responses are POS;, ZERO;, or NEG;.
  211.  
  212.           (C1) INTEGRATE(SIN(X)**3,X);
  213.                               3
  214.                            COS (X)
  215.           (D1)             ------- - COS(X)
  216.                               3
  217.           (C2) INTEGRATE(X**A/(X+1)**(5/2),X,0,INF);
  218.           IS  A + 1  POSITIVE, NEGATIVE, OR ZERO?
  219.           POS;
  220.           IS  2 A - 3  POSITIVE, NEGATIVE, OR ZERO?
  221.           NEG;
  222.                                       3
  223.           (D2)            BETA(A + 1, - - A)
  224.                                       2
  225.           (C3) GRADEF(Q(X),SIN(X**2));
  226.           (D3)                              Q(X)
  227.           (C4) DIFF(LOG(Q(R(X))),X);
  228.                                      d             2
  229.                                     (-- R(X)) SIN(R (X))
  230.                                      dX
  231.           (D4)                      --------------------
  232.                                           Q(R(X))
  233.           (C5) INTEGRATE(%,X);
  234.           (D5)                          LOG(Q(R(X)))
  235.      (Note 1) The fact that MACSYMA does not perform certain integrals
  236.      does not always imply that the integral does not exist in closed
  237.      form. In the example below the integration call returns the noun
  238.      form but the integral can be found fairly easily. For example, one
  239.      can compute the roots of `X^3+X+1 = 0' to rewrite the integrand in
  240.      the form
  241.           1/((X-A)*(X-B)*(X-C))
  242.      where A, B and C are the roots. MACSYMA will integrate this
  243.      equivalent form although the integral is quite complicated.
  244.           (C6) INTEGRATE(1/(X^3+X+1),X);
  245.                                     /
  246.                                     [     1
  247.           (D6)                      I ---------- dX
  248.                                     ]  3
  249.                                     / X  + X + 1
  250.  
  251.  - Variable: INTEGRATION_CONSTANT_COUNTER
  252.      - a counter which is updated each time a constant of integration
  253.      (called by MACSYMA, e.g., "INTEGRATIONCONSTANT1") is introduced
  254.      into an expression by indefinite integration of an equation.
  255.  
  256.  
  257.  - Variable: INTEGRATE_USE_ROOTSOF
  258.      default: [false] If not false then when the denominator of an
  259.      rational function cannot be factored, we give the integral in a
  260.      form which is a sum over the roots of the denominator:
  261.  
  262.           (C4) integrate(1/(1+x+x^5),x);
  263.           
  264.                 /     2
  265.                 [ x  - 4 x + 5
  266.                 I ------------ dx                   2 x + 1
  267.                 ]     3    2               2        5 ATAN(-------)
  268.                 / x  - x  + 1      LOG(x  + x + 1)       SQRT(3)
  269.           (D4)  ----------------- - --------------- + ---------------
  270.                     7                14           7 SQRT(3)
  271.      but now we set the flag to be true and the first part of the
  272.      integral will undergo further simplification.
  273.           (C5) INTEGRATE_USE_ROOTSOF:true;
  274.           
  275.           (D5)                   TRUE
  276.  
  277.           (C6) integrate(1/(1+x+x^5),x);
  278.           
  279.                ====        2
  280.                \       (%R1  - 4 %R1 + 5) LOG(x - %R1)
  281.                 >      -------------------------------
  282.                /                    2
  283.                ====            3 %R1  - 2 %R1
  284.                                3    2
  285.                %R1 in ROOTSOF(x  - x  + 1)
  286.           (D6) ----------------------------------------------------------
  287.                         7
  288.           
  289.                                                                    2 x + 1
  290.                                                2            5 ATAN(-------)
  291.                                           LOG(x  + x + 1)          SQRT(3)
  292.                                         - --------------- + ---------------
  293.                                                 14             7 SQRT(3)
  294.  
  295.      Note that it may be that we want to approximate the roots in the
  296.      complex plane, and then provide the function factored, since we
  297.      will then be able to group the roots and their complex conjugates,
  298.      so as to give a better answer.
  299.  
  300.  
  301.  - Function: INTSCE (expr,var)
  302.      INTSCE LISP contains a routine, written by Richard Bogen, for
  303.      integrating products of sines,cosines and exponentials of the form
  304.             EXP(A*X+B)*COS(C*X)^N*SIN(C*X)^M
  305.      The call is INTSCE(expr,var) expr may be any expression, but if it
  306.      is not in the above form then the regular integration program will
  307.      be invoked if the switch ERRINTSCE[TRUE] is TRUE.  If it is FALSE
  308.      then INTSCE will err out.
  309.  
  310.  
  311.  - Function: LDEFINT (exp,var,ll,ul)
  312.      yields the definite integral of exp by using LIMIT to evaluate the
  313.      indefinite integral of exp with respect to var at the upper limit
  314.      ul and at the lower limit ll.
  315.  
  316.  
  317.  - Function: POTENTIAL (givengradient)
  318.      The calculation makes use of the global variable
  319.           POTENTIALZEROLOC[0]
  320.       which must be NONLIST or of the form
  321.  
  322.           [indeterminatej=expressionj, indeterminatek=expressionk, ...]
  323.      the former being equivalent to the nonlist expression for all
  324.      right-hand sides in the latter.  The indicated right-hand sides
  325.      are used as the lower limit of integration.  The success of the
  326.      integrations may depend upon their values and order.
  327.      POTENTIALZEROLOC is initially set to 0.
  328.  
  329.  
  330.  - Function: QQ
  331.      - The file SHARE1;QQ FASL (which may be loaded with LOAD("QQ");)
  332.      contains a function QUANC8 which can take either 3 or 4 arguments.
  333.      The 3 arg version computes the integral of the function specified
  334.      as the first argument over the interval from lo to hi as in
  335.      QUANC8('function name,lo,hi); .  The function name should be
  336.      quoted.  The 4 arg version will compute the integral of the
  337.      function or expression (first arg) with respect to the variable
  338.      (second arg) over the interval from lo to hi as in QUANC8(<f(x) or
  339.      expression in x>,x,lo,hi).  The method used is the Newton-Cotes
  340.      8th order polynomial quadrature, and the routine is adaptive. It
  341.      will thus spend time dividing the interval only when necessary to
  342.      achieve the error conditions specified by the global variables
  343.      QUANC8_RELERR (default value=1.0e-4) and QUANC8_ABSERR (default
  344.      value=1.0e-8) which give the relative error test:
  345.      |integral(function)-computed value|<
  346.      quanc8_relerr*|integral(function)| and the absolute error test:
  347.      |integral(function)-computed value|<quanc8_abserr.  Do
  348.      PRINTFILE(QQ,USAGE,SHARE1) for details.
  349.  
  350.  
  351.  - Function: QUANC8 ('function name,lo,hi)
  352.      An adaptive integrator, available in SHARE1;QQ FASL.  DEMO and
  353.      USAGE files are provided.  The method is to use Newton-Cotes
  354.      8-panel quadrature rule, hence the function name QUANC8, available
  355.      in 3 or 4 arg versions.  Absolute and relative error checks are
  356.      used.  To use it do LOAD("QQ");  For more details do DESCRIBE(QQ);
  357.      .
  358.  
  359.  
  360.  - Function: RESIDUE (exp, var, val)
  361.      computes the residue in the complex plane of the expression exp
  362.      when the variable var assumes the value val.  The residue is the
  363.      coefficient of (var-val)**(-1) in the Laurent series for exp.
  364.           (C1) RESIDUE(S/(S**2+A**2),S,A*%I);
  365.                                   1
  366.           (D1)                    -
  367.                                   2
  368.           (C2) RESIDUE(SIN(A*X)/X**4,X,0);
  369.                                   3
  370.                                  A
  371.           (D2)                 - --
  372.                                  6
  373.  
  374.  - Function: RISCH (exp, var)
  375.      integrates exp with respect to var using the transcendental case
  376.      of the Risch algorithm.  (The algebraic case of the Risch
  377.      algorithm has not been implemented.)  This currently handles the
  378.      cases of nested exponentials and logarithms which the main part of
  379.      INTEGRATE can't do.  INTEGRATE will automatically apply RISCH if
  380.      given these cases.  ERFFLAG[TRUE] - if FALSE prevents RISCH from
  381.      introducing the ERF function in the answer if there were none in
  382.      the integrand to begin with.
  383.           (C1) RISCH(X^2*ERF(X),X);
  384.                       2     2
  385.                    - X     X             3           2
  386.                  %E     (%E   SQRT(%PI) X  ERF(X) + X  + 1)
  387.           (D1)   ------------------------------------------
  388.                                 3 SQRT(%PI)
  389.           (C2) DIFF(%,X),RATSIMP;
  390.                                            2
  391.           (D2)                            X  ERF(X)
  392.  
  393.  - Function: ROMBERG (exp,var,ll,ul)
  394.      or ROMBERG(exp,ll,ul) - Romberg Integration.  You need not load in
  395.      any file to use ROMBERG, it is autoloading.  There are two ways to
  396.      use this function.  The first is an inefficient way like the
  397.      definite integral version of INTEGRATE:
  398.      ROMBERG(<integrand>,<variable of integration>,<lower limit>,
  399.               <upper limit>);
  400.           Examples:
  401.                   ROMBERG(SIN(Y),Y,1,%PI);
  402.                           TIME= 39 MSEC.          1.5403023
  403.                   F(X):=1/(X^5+X+1);
  404.                   ROMBERG(F(X),X,1.5,0);
  405.                           TIME= 162 MSEC.         - 0.75293843
  406.      The second is an efficient way that is used as follows:
  407.  
  408.           ROMBERG(<function name>,<lower limit>,<upper limit>);
  409.  
  410.           Example:
  411.           F(X):=(MODE_DECLARE([FUNCTION(F),X],FLOAT),1/(X^5+X+1));
  412.           TRANSLATE(F);
  413.           ROMBERG(F,1.5,0);
  414.                   TIME= 13 MSEC.          - 0.75293843
  415.      The first argument must be a TRANSLATEd or compiled function.  (If
  416.      it is compiled it must be declared to return a FLONUM.)  If the
  417.      first argument is not already TRANSLATEd, ROMBERG will not attempt
  418.      to TRANSLATE it but will give an error.  The accuracy of the
  419.      integration is governed by the global variables ROMBERGTOL
  420.      (default value 1.E-4) and ROMBERGIT (default value 11).  ROMBERG
  421.      will return a result if the relative difference in successive
  422.      approximations is less than ROMBERGTOL.  It will try halving the
  423.      stepsize ROMBERGIT times before it gives up.  The number of
  424.      iterations and function evaluations which ROMBERG will do is
  425.      governed by ROMBERGABS and ROMBERGMIN, do
  426.      DESCRIBE(ROMBERGABS,ROMBERGMIN); for details.  ROMBERG may be
  427.      called recursively and thus can do double and triple integrals.
  428.           Example:
  429.           INTEGRATE(INTEGRATE(X*Y/(X+Y),Y,0,X/2),X,1,3);
  430.                                   13/3 (2 LOG(2/3) + 1)
  431.           %,NUMER;
  432.                                   0.81930233
  433.           DEFINE_VARIABLE(X,0.0,FLOAT,"Global variable in function F")$
  434.           F(Y):=(MODE_DECLARE(Y,FLOAT), X*Y/(X+Y) )$
  435.           G(X):=ROMBERG('F,0,X/2)$
  436.           ROMBERG(G,1,3);
  437.                                    0.8193023
  438.      The advantage with this way is that the function F can be used for
  439.      other purposes, like plotting. The disadvantage is that you have
  440.      to think up a name for both the function F and its free variable X.
  441.      Or, without the global:
  442.                   G1(X):=(MODE_DECLARE(X,FLOAT), ROMBERG(X*Y/(X+Y),Y,0,X/2))$
  443.                   ROMBERG(G1,1,3);
  444.                                           0.8193023
  445.      The advantage here is shortness.
  446.                   Q(A,B):=ROMBERG(ROMBERG(X*Y/(X+Y),Y,0,X/2),X,A,B)$
  447.                   Q(1,3);
  448.                                           0.8193023
  449.      It is even shorter this way, and the variables do not need to be
  450.      declared because they are in the context of ROMBERG.  Use of
  451.      ROMBERG for multiple integrals can have great disadvantages,
  452.      though.  The amount of extra calculation needed because of the
  453.      geometric information thrown away by expressing multiple integrals
  454.      this way can be incredible.  The user should be sure to understand
  455.      and use the ROMBERGTOL and ROMBERGIT switches.
  456.  
  457.  
  458.  - Variable: ROMBERGABS
  459.      default: [0.0] (0.0B0) Assuming that successive estimates produced
  460.      by ROMBERG are Y[0], Y[1], Y[2] etc., then ROMBERG will return
  461.      after N iterations if (roughly speaking)  (ABS(Y[N]-Y[N-1]) <=
  462.      ROMBERGABS OR  ABS(Y[N]-Y[N-1])/(IF Y[N]=0.0 THEN 1.0 ELSE Y[N])
  463.      <= ROMBERGTOL) is TRUE.  (The condition on the number of
  464.      iterations given by ROMBERGMIN must also be satisfied.)  Thus if
  465.      ROMBERGABS is 0.0 (the default) you just get the relative error
  466.      test.  The usefulness of the additional variable comes when you
  467.      want to perform an integral, where the dominant contribution comes
  468.      from a small region.  Then you can do the integral over the small
  469.      dominant region first, using the relative accuracy check, followed
  470.      by the integral over the rest of the region using the absolute
  471.      accuracy check.  Example:  Suppose you want to compute
  472.              Integral(exp(-x),x,0,50)
  473.      (numerically) with a relative accuracy of  1 part in 10000000.
  474.      Define the function.  N is a counter, so we can see how many
  475.      function evaluations were needed.
  476.           F(X):=(MODE_DECLARE(N,INTEGER,X,FLOAT),N:N+1,EXP(-X))$
  477.           TRANSLATE(F)$
  478.             /* First of all try doing the whole integral at once */
  479.           BLOCK([ROMBERGTOL:1.E-6,ROMBERABS:0.],N:0,ROMBERG(F,0,50));
  480.                         ==> 1.00000003
  481.           N; ==> 257  /* Number of function evaluations*/
  482.  
  483.      Now do the integral intelligently, by first doing
  484.      Integral(exp(-x),x,0,10) and then setting ROMBERGABS to 1.E-6*(this
  485.          partial integral).
  486.           BLOCK([ROMBERGTOL:1.E-6,ROMBERGABS:0.,SUM:0.],
  487.             N:0,SUM:ROMBERG(F,0,10),ROMBERGABS:SUM*ROMBERGTOL,ROMBERGTOL:0.,
  488.                 SUM+ROMBERG(F,10,50));  ==> 1.00000001  /* Same as before */
  489.           N;  ==> 130
  490.      So if F(X) were a function that took a long time to compute, the
  491.      second method would be about 2 times quicker.
  492.  
  493.  
  494.  - Variable: ROMBERGIT
  495.      default: [11] - The accuracy of the ROMBERG integration command is
  496.      governed by the global variables ROMBERGTOL[1.E-4] and
  497.      ROMBERGIT[11].  ROMBERG will return a result if the relative
  498.      difference in successive approximations is less than ROMBERGTOL.
  499.      It will try halving the stepsize ROMBERGIT times before it gives
  500.      up.
  501.  
  502.  
  503.  - Variable: ROMBERGMIN
  504.      default: [0] - governs the minimum number of function evaluations
  505.      that ROMBERG will make.  ROMBERG will evaluate its first arg. at
  506.      least 2^(ROMBERGMIN+2)+1 times.  This is useful for integrating
  507.      oscillatory functions, when the normal converge test might
  508.      sometimes wrongly pass.
  509.  
  510.  
  511.  - Variable: ROMBERGTOL
  512.      default: [1.E-4] - The accuracy of the ROMBERG integration command
  513.      is governed by the global variables ROMBERGTOL[1.E-4] and
  514.      ROMBERGIT[11].  ROMBERG will return a result if the relative
  515.      difference in successive approximations is less than ROMBERGTOL.
  516.      It will try halving the stepsize ROMBERGIT times before it gives
  517.      up.
  518.  
  519.  
  520.  - Function: TLDEFINT (exp,var,ll,ul)
  521.      is just LDEFINT with TLIMSWITCH set to TRUE.
  522.  
  523.  
  524. 
  525. File: maxima.info,  Node: Equations,  Next: Differential Equations,  Prev: Integration,  Up: Top
  526.  
  527. Equations
  528. *********
  529.  
  530. * Menu:
  531.  
  532. * Definitions for Equations::
  533.  
  534. 
  535. File: maxima.info,  Node: Definitions for Equations,  Prev: Equations,  Up: Equations
  536.  
  537. Definitions for Equations
  538. =========================
  539.  
  540.  - Variable: %RNUM_LIST
  541.      default: [] - When %R variables are introduced in solutions by the
  542.      ALGSYS command, they are added to %RNUM_LIST in the order they are
  543.      created.  This is convenient for doing substitutions into the
  544.      solution later on.  It's recommended to use this list rather than
  545.      doing CONCAT('%R,J).
  546.  
  547.  - Variable: ALGEXACT
  548.      default: [FALSE] affects the behavior of ALGSYS as follows: If
  549.      ALGEXACT is TRUE, ALGSYS always calls SOLVE and then uses REALROOTS
  550.      on SOLVE's failures.  If ALGEXACT is FALSE, SOLVE is called only if
  551.      the eliminant was not univariate, or if it was a quadratic or
  552.      biquadratic.  Thus ALGEXACT:TRUE doesn't guarantee only exact
  553.      solutions, just that ALGSYS will first try as hard as it can to
  554.      give exact solutions, and only yield approximations when all else
  555.      fails.
  556.  
  557.  - Function: ALGSYS ([exp1, exp2, ...], [var1, var2, ...])
  558.      solves the list of simultaneous polynomials or polynomial
  559.      equations (which can be non-linear) for the list of variables.
  560.      The symbols %R1, %R2, etc.  will be used to represent arbitrary
  561.      parameters when needed for the solution (the variable %RNUM_LIST
  562.      holds these).  In the process described below, ALGSYS is entered
  563.      recursively if necessary.      The method is as follows: (1) First
  564.      the equations are FACTORed and split into subsystems.  (2) For
  565.      each subsystem Si, an equation E and a variable var are selected
  566.      (the var is chosen to have lowest nonzero degree).  Then the
  567.      resultant of E and Ej with respect to var is computed for each of
  568.      the remaining equations Ej in the subsystem Si.  This yields a new
  569.      subsystem S'i in one fewer variables (var has been eliminated).
  570.      The process now returns to (1).  (3) Eventually, a subsystem
  571.      consisting of a single equation is obtained.  If the equation is
  572.      multivariate and no approximations in the form of floating point
  573.      numbers have been introduced, then SOLVE is called to find an
  574.      exact solution.  (The user should realize that SOLVE may not be
  575.      able to produce a solution or if it does the solution may be a
  576.      very large expression.)      If the equation is univariate and is
  577.      either linear, quadratic, or bi-quadratic, then again SOLVE is
  578.      called if no approximations have been introduced.  If
  579.      approximations have been introduced or the equation is not
  580.      univariate and neither linear, quadratic, or bi-quadratic, then if
  581.      the switch REALONLY[FALSE] is TRUE, the function REALROOTS is
  582.      called to find the real-valued solutions.  If REALONLY:FALSE then
  583.      ALLROOTS is called which looks for real and complex-valued
  584.      solutions.  If ALGSYS produces a solution which has fewer
  585.      significant digits than required, the user can change the value of
  586.      ALGEPSILON[10^8] to a higher value.  If ALGEXACT[FALSE] is set to
  587.      TRUE, SOLVE will always be called.  (4) Finally, the solutions
  588.      obtained in step (3) are re-inserted into previous levels and the
  589.      solution process returns to (1).  The user should be aware of
  590.      several caveats:     When ALGSYS encounters a multivariate
  591.      equation which contains floating point approximations (usually due
  592.      to its failing to find exact solutions at an earlier stage), then
  593.      it does not attempt to apply exact methods to such equations and
  594.      instead prints the message:         "ALGSYS cannot solve - system
  595.      too complicated."      Interactions with RADCAN can produce large
  596.      or complicated expressions.  In that case, the user may use
  597.      PICKAPART or REVEAL to analyze the solution.  Occasionally, RADCAN
  598.      may introduce an apparent %I into a solution which is actually
  599.      real-valued.  Do EXAMPLE(ALGSYS); for examples.
  600.  
  601.  
  602.  - Function: ALLROOTS (poly)
  603.      finds all the real and complex roots of the real polynomial poly
  604.      which must be univariate and may be an equation, e.g.  poly=0.
  605.      For complex polynomials an algorithm by Jenkins and Traub is used
  606.      (Algorithm 419, Comm. ACM, vol. 15, (1972), p. 97).  For real
  607.      polynomials the algorithm used is due to Jenkins (Algorithm 493,
  608.      TOMS, vol. 1, (1975), p.178).  The flag POLYFACTOR[FALSE] when
  609.      true causes ALLROOTS to factor the polynomial over the real
  610.      numbers if the polynomial is real, or over the complex numbers, if
  611.      the polynomial is complex.  ALLROOTS may give inaccurate results
  612.      in case of multiple roots.  (If poly is real and you get
  613.      inaccurate answers, you may want to try ALLROOTS(%I*poly);) Do
  614.      EXAMPLE(ALLROOTS); for an example.  ALLROOTS rejects
  615.      non-polynomials.  It requires that the numerator after RATting
  616.      should be a polynomial, and it requires that the denominator be at
  617.      most a complex number.  As a result of this ALLROOTS will always
  618.      return an equivalent (but factored) expression, if POLYFACTOR is
  619.      TRUE.
  620.  
  621.  
  622.  - Variable: BACKSUBST
  623.      default: [TRUE] if set to FALSE will prevent back substitution
  624.      after the equations have been triangularized.  This may be
  625.      necessary in very big problems where back substitution would cause
  626.      the generation of extremely large expressions.  (On MC this could
  627.      cause storage capacity to be exceeded.)
  628.  
  629.  
  630.  - Variable: BREAKUP
  631.      default: [TRUE] if FALSE will cause SOLVE to express the solutions
  632.      of cubic or quartic equations as single expressions rather than as
  633.      made up of several common subexpressions which is the default.
  634.      BREAKUP:TRUE only works when PROGRAMMODE is FALSE.
  635.  
  636.  
  637.  - Function: DIMENSION (equation or list of equations)
  638.      The file "share1/dimen.mc" contains functions for automatic
  639.      dimensional analysis.  LOAD(DIMEN); will load it up for you.
  640.      There is a demonstration available in share1/dimen.dem.  Do
  641.      DEMO("dimen"); to run it.
  642.  
  643.  
  644.  - Variable: DISPFLAG
  645.      default: [TRUE] if set to FALSE within a BLOCK will inhibit the
  646.      display of output generated by the solve functions called from
  647.      within  the BLOCK.  Termination of the BLOCK with a dollar sign,
  648.      $, sets DISPFLAG to FALSE.
  649.  
  650.  
  651.  - Function: FUNCSOLVE (eqn,g(t))
  652.      gives [g(t) = ...]  or [], depending on whether or not there
  653.      exists a rational fcn g(t) satisfying eqn, which must be a first
  654.      order, linear polynomial in (for this case) g(t) and g(t+1).
  655.           (C1) FUNCSOLVE((N+1)*FOO(N)-(N+3)*FOO(N+1)/(N+1) =
  656.               (N-1)/(N+2),FOO(N));
  657.                                              N
  658.           (D1)               FOO(N) = ---------------
  659.                                       (N + 1) (N + 2)
  660.      Warning: this is a very rudimentary implementation-many safety
  661.      checks and obvious generalizations are missing.
  662.  
  663.  
  664.  - Variable: GLOBALSOLVE
  665.      default: [FALSE] if set to TRUE then variables which are SOLVEd
  666.      for will be set to the solution of the set of simultaneous
  667.      equations.
  668.  
  669.  
  670.  - Function: IEQN (ie,unk,tech,n,guess)
  671.      Integral Equation solving routine.  Do LOAD(INTEQN); to access it.
  672.      CAVEAT: To free some storage, a KILL(LABELS) is included in this
  673.      file.  Therefore, before loading the integral equation package,
  674.      the user should give names to any expressions he wants to keep.
  675.      ie is the integral equation; unk is the unknown function; tech is
  676.      the technique to be tried from those given above (tech = FIRST
  677.      means: try the first technique which finds a solution; tech = ALL
  678.      means: try all applicable techniques); n is the maximum number of
  679.      terms to take for TAYLOR, NEUMANN, FIRSTKINDSERIES, or FREDSERIES
  680.      (it is also the maximum depth of recursion for the differentiation
  681.      method); guess is the initial guess for NEUMANN or FIRSTKINDSERIES.
  682.      Default values for the 2nd thru 5th parameters are: unk: P(X),
  683.      where P is the first function encountered in an integrand which is
  684.      unknown to MACSYMA and X is the variable which occurs as an
  685.      argument to the first occurrence of P found outside of an integral
  686.      in the case of SECONDKIND equations, or is the only other variable
  687.      besides the variable of integration in FIRSTKIND equations.  If the
  688.      attempt to search for X fails, the user will be asked to supply the
  689.      independent variable; tech: FIRST; n: 1; guess: NONE, which will
  690.      cause NEUMANN and FIRSTKINDSERIES to use F(X) as an initial guess.
  691.  
  692.  
  693.  - Variable: IEQNPRINT
  694.      default: [TRUE] - governs the behavior of the result returned by
  695.      the IEQN command (which see).  If IEQNPRINT is set to FALSE, the
  696.      lists returned by the IEQN function are of the form    [SOLUTION,
  697.      TECHNIQUE USED, NTERMS, FLAG] where FLAG is absent if the solution
  698.      is exact.  Otherwise, it is the word APPROXIMATE or INCOMPLETE
  699.      corresponding to an inexact or non-closed form solution,
  700.      respectively. If a series method was used, NTERMS gives the number
  701.      of terms taken (which could be less than the n given to IEQN if an
  702.      error prevented generation of further terms).
  703.  
  704.  
  705.  - Function: LHS (eqn)
  706.      the left side of the equation eqn.
  707.  
  708.  
  709.  - Function: LINSOLVE ([exp1, exp2, ...], [var1, var2, ...])
  710.      solves the list of simultaneous linear equations for the list of
  711.      variables.  The expi must each be polynomials in the variables and
  712.      may be equations.  If GLOBALSOLVE[FALSE] is set to TRUE then
  713.      variables which are SOLVEd for will be set to the solution of the
  714.      set of simultaneous equations.  BACKSUBST[TRUE] if set to FALSE
  715.      will prevent back substitution after the equations have been
  716.      triangularized.  This may be necessary in very big problems where
  717.      back substitution would cause the generation of extremely large
  718.      expressions.  (On MC this could cause the storage capacity to be
  719.      exceeded.)  LINSOLVE_PARAMS[TRUE] If TRUE, LINSOLVE also generates
  720.      the %Ri symbols used to represent arbitrary parameters described
  721.      in the manual under ALGSYS.  If FALSE, LINSOLVE behaves as before,
  722.      i.e. when it meets up with an under-determined system of
  723.      equations, it solves for some of the variables in terms of others.
  724.           (C1) X+Z=Y$
  725.           (C2) 2*A*X-Y=2*A**2$
  726.           (C3) Y-2*Z=2$
  727.           (C4) LINSOLVE([D1,D2,D3],[X,Y,Z]),GLOBALSOLVE:TRUE;
  728.           SOLUTION
  729.           (E4)                            X : A + 1
  730.           (E5)                             Y : 2 A
  731.           (E6)                            Z : A - 1
  732.           (D6)                          [E4, E5, E6]
  733.  
  734.  - Variable: LINSOLVEWARN
  735.      default: [TRUE] - if FALSE will cause the message "Dependent
  736.      equations eliminated" to be suppressed.
  737.  
  738.  
  739.  - Variable: LINSOLVE_PARAMS
  740.      default: [TRUE] - If TRUE, LINSOLVE also generates the %Ri symbols
  741.      used to represent arbitrary parameters described in the manual
  742.      under ALGSYS.  If FALSE, LINSOLVE behaves as before, i.e.  when it
  743.      meets up with an under-determined system of equations, it solves
  744.      for some of the variables in terms of others.
  745.  
  746.  
  747.  - Variable: MULTIPLICITIES
  748.      default: [NOT_SET_YET] - will be set to a list of the
  749.      multiplicities of the individual solutions returned by SOLVE or
  750.      REALROOTS.
  751.  
  752.  
  753.  - Function: NROOTS (poly, low, high)
  754.      finds the number of real roots of the real univariate polynomial
  755.      poly in the half-open interval (low,high].  The endpoints of the
  756.      interval may also be MINF,INF respectively for minus infinity and
  757.      plus infinity.  The method of Sturm sequences is used.
  758.           (C1) POLY1:X**10-2*X**4+1/2$
  759.           (C2) NROOTS(POLY1,-6,9.1);
  760.           RAT REPLACED 0.5 BY 1/2 = 0.5
  761.           (D2)                               4
  762.  
  763.  - Function: NTHROOT (p,n)
  764.      where p is a polynomial with integer coefficients and n is a
  765.      positive integer returns q, a polynomial over the integers, such
  766.      that q^n=p or prints an error message indicating that p is not a
  767.      perfect nth power. This routine is much faster than FACTOR or even
  768.      SQFR.
  769.  
  770.  
  771.  - Variable: PROGRAMMODE
  772.      default: [TRUE] - when FALSE will cause SOLVE, REALROOTS,
  773.      ALLROOTS, and LINSOLVE to print E-labels (intermediate line
  774.      labels) to label answers.  When TRUE, SOLVE, etc. return answers
  775.      as elements in a list.  (Except when BACKSUBST is set to FALSE, in
  776.      which case PROGRAMMODE:FALSE is also used.)
  777.  
  778.  
  779.  - Variable: REALONLY
  780.      default: [FALSE] - if TRUE causes ALGSYS to return only those
  781.      solutions which are free of %I.
  782.  
  783.  
  784.  - Function: REALROOTS (poly, bound)
  785.      finds all of the real roots of the real univariate polynomial poly
  786.      within a tolerance of bound which, if less than 1, causes all
  787.      integral roots to be found exactly.  The parameter bound may be
  788.      arbitrarily small in order to achieve any desired accuracy.  The
  789.      first argument may also be an equation.  REALROOTS sets
  790.      MULTIPLICITIES, useful in case of multiple roots.  REALROOTS(poly)
  791.      is equivalent to REALROOTS(poly,ROOTSEPSILON).
  792.      ROOTSEPSILON[1.0E-7] is a real number used to establish the
  793.      confidence interval for the roots.  Do EXAMPLE(REALROOTS); for an
  794.      example.
  795.  
  796.  
  797.  - Function: RHS (eqn)
  798.      the right side of the equation eqn.
  799.  
  800.  
  801.  - Variable: ROOTSCONMODE
  802.      default: [TRUE] - Determines the behavior of the ROOTSCONTRACT
  803.      command.  Do DESCRIBE(ROOTSCONTRACT); for details.
  804.  
  805.  
  806.  - Function: ROOTSCONTRACT (exp)
  807.      converts products of roots into roots of products.  For example,
  808.           ROOTSCONTRACT(SQRT(X)*Y^(3/2)) ==> SQRT(X*Y^3)
  809.      When RADEXPAND is TRUE and DOMAIN is REAL (their defaults),
  810.      ROOTSCONTRACT converts ABS into SQRT, e.g.
  811.  
  812.           ROOTSCONTRACT(ABS(X)*SQRT(Y)) ==> SQRT(X^2*Y)
  813.  
  814.      There is an option ROOTSCONMODE (default value TRUE), affecting
  815.      ROOTSCONTRACT as follows:
  816.  
  817.  
  818.  
  819.           Problem            Value of        Result of applying
  820.                             ROOTSCONMODE        ROOTSCONTRACT
  821.           
  822.           X^(1/2)*Y^(3/2)      FALSE          (X*Y^3)^(1/2)
  823.           X^(1/2)*Y^(1/4)      FALSE          X^(1/2)*Y^(1/4)
  824.           X^(1/2)*Y^(1/4)      TRUE           (X*Y^(1/2))^(1/2)
  825.           X^(1/2)*Y^(1/3)      TRUE           X^(1/2)*Y^(1/3)
  826.           X^(1/2)*Y^(1/4)      ALL            (X^2*Y)^(1/4)
  827.           X^(1/2)*Y^(1/3)      ALL            (X^3*Y^2)^(1/6)
  828.  
  829.      The above examples and more may be tried out by typing
  830.  
  831.           EXAMPLE(ROOTSCONTRACT);
  832.  
  833.      When ROOTSCONMODE is FALSE, ROOTSCONTRACT contracts only wrt
  834.      rational number exponents whose denominators are the same.  The
  835.      key to the ROOTSCONMODE:TRUE$ examples is simply that 2 divides
  836.      into 4 but not into 3.  ROOTSCONMODE:ALL$ involves taking the lcm
  837.      (least common multiple) of the denominators of the exponents.
  838.      ROOTSCONTRACT uses RATSIMP in a manner similar to LOGCONTRACT (see
  839.      the manual).
  840.  
  841.  
  842.  - Variable: ROOTSEPSILON
  843.      default: [1.0E-7] - a real number used to establish the confidence
  844.      interval for the roots found by the REALROOTS function.
  845.  
  846.  
  847.  - Function: SOLVE (exp, var)
  848.      solves the algebraic equation exp for the variable var and returns
  849.      a list of solution equations in var.  If exp is not an equation,
  850.      it is assumed to be an expression to be set equal to zero.  Var
  851.      may be a function (e.g. F(X)), or other non-atomic expression
  852.      except a sum or product. It may be omitted if exp contains only one
  853.      variable.  Exp may be a rational expression, and may contain
  854.      trigonometric functions, exponentials, etc.  The following method
  855.      is used: Let E be the expression and X be the variable.  If E is
  856.      linear in X then it is trivially solved for X.  Otherwise if E is
  857.      of the form A*X**N+B then the result is (-B/A)**(1/N) times the
  858.      Nth roots of unity.  If E is not linear in X then the gcd of the
  859.      exponents of X in E (say N) is divided into the exponents and the
  860.      multiplicity of the roots is multiplied by N.  Then SOLVE is
  861.      called again on the result.  If E factors then SOLVE is called on
  862.      each of the factors.  Finally SOLVE will use the quadratic, cubic,
  863.      or quartic formulas where necessary.  In the case where E is a
  864.      polynomial in some function of the variable to be solved for, say
  865.      F(X), then it is first solved for F(X) (call the result C), then
  866.      the equation F(X)=C can be solved for X provided the inverse of
  867.      the function F is known.  BREAKUP[TRUE] if FALSE will cause SOLVE
  868.      to express the solutions of cubic or quartic equations as single
  869.      expressions rather than as made up of several common
  870.      subexpressions which is the default.  MULTIPLICITIES[NOT_SET_YET]
  871.      - will be set to a list of the multiplicities of the individual
  872.      solutions returned by SOLVE, REALROOTS, or ALLROOTS.  Try
  873.      APROPOS(SOLVE) for the switches which affect SOLVE.  DESCRIBE may
  874.      then by used on the individual switch names if their purpose is not
  875.      clear.  SOLVE([eq1, ..., eqn], [v1, ..., vn]) solves a system of
  876.      simultaneous (linear or non-linear) polynomial equations by
  877.      calling LINSOLVE or ALGSYS and returns a list of the solution
  878.      lists in the variables.  In the case of LINSOLVE this list would
  879.      contain a single list of solutions.  It takes two lists as
  880.      arguments.  The first list (eqi, i=1,...,n) represents the
  881.      equations to be solved; the second list is a list of the unknowns
  882.      to be determined.  If the total number of variables in the
  883.      equations is equal to the number of equations, the second
  884.      argument-list may be omitted.  For linear systems if the given
  885.      equations are not compatible, the message INCONSISTENT will be
  886.      displayed (see the SOLVE_INCONSISTENT_ERROR switch); if no unique
  887.      solution exists, then SINGULAR will be displayed.  For examples, do
  888.      EXAMPLE(SOLVE);
  889.  
  890.  
  891.  - Variable: SOLVEDECOMPOSES
  892.      default: [TRUE] - if TRUE, will induce SOLVE to use POLYDECOMP
  893.      (see POLYDECOMP) in attempting to solve polynomials.
  894.  
  895.  
  896.  - Variable: SOLVEEXPLICIT
  897.      default: [FALSE] - if TRUE, inhibits SOLVE from returning implicit
  898.      solutions i.e. of the form F(x)=0.
  899.  
  900.  
  901.  - Variable: SOLVEFACTORS
  902.      default: [TRUE] - if FALSE then SOLVE will not try to factor the
  903.      expression.  The FALSE setting may be desired in some cases where
  904.      factoring is not necessary.
  905.  
  906.  
  907.  - Variable: SOLVENULLWARN
  908.      default: [TRUE] - if TRUE the user will be warned if he calls
  909.      SOLVE with either a null equation list or a null variable list.
  910.      For example, SOLVE([],[]); would print two warning messages and
  911.      return [].
  912.  
  913.  
  914.  - Variable: SOLVERADCAN
  915.      default: [FALSE] - if TRUE then SOLVE will use RADCAN which will
  916.      make SOLVE slower but will allow certain problems containing
  917.      exponentials and logs to be solved.
  918.  
  919.  
  920.  - Variable: SOLVETRIGWARN
  921.      default: [TRUE] - if set to FALSE will inhibit printing by SOLVE
  922.      of the warning message saying that it is using inverse
  923.      trigonometric functions to solve the equation, and thereby losing
  924.      solutions.
  925.  
  926.  
  927.  - Variable: SOLVE_INCONSISTENT_ERROR
  928.      default: [TRUE] - If TRUE, SOLVE and LINSOLVE give an error if
  929.      they meet up with a set of inconsistent linear equations, e.g.
  930.      SOLVE([A+B=1,A+B=2]).  If FALSE, they return [] in this case.
  931.      (This is the new mode, previously gotten only by calling ALGSYS.)
  932.  
  933.  
  934.  - Function: ZRPOLY
  935.      - This is no longer available in Maxima. See ALLROOTS for a
  936.      function    to compute the roots of a polynomial.
  937.  
  938.  
  939.  - Function: ZSOLVE
  940.      This is not available with Maxima anymore.  Documentation is left
  941.      for  historical purposes.
  942.  
  943.      - For those who can make use of approximate numerical solutions to
  944.      problems, there is a package which calls a routine which has been
  945.      translated from the IMSL fortran library to solve N simultaneous
  946.      non-linear equations in N unknowns.  It uses black-box techniques
  947.      that probably aren't desirable if an exact solution can be
  948.      obtained from one of the smarter solvers (LINSOLVE, ALGSYS, etc).
  949.      But for things that the other solvers don't attempt to handle,
  950.      this can probably give some very useful results.  For
  951.      documentation, do PRINTFILE("zsolve.usg");.  For a demo do
  952.      batch("zsolve.mc")$
  953.  
  954.  
  955. 
  956. File: maxima.info,  Node: Differential Equations,  Next: Numerical,  Prev: Equations,  Up: Top
  957.  
  958. Differential Equations
  959. **********************
  960.  
  961. * Menu:
  962.  
  963. * Definitions for Differential Equations::
  964.  
  965.